﻿package {

	import flash.events.Event;
	import org.molamil.acto.core.events.ConfLoadEvent;
	import org.molamil.acto.core.loggers.Logger;
	import org.molamil.acto.App;
	import flash.display.Sprite;

	public class Main extends Sprite {
		
		
		// CLASSPATH
		
		TestView; TestCommand; TransitionManager; TestClass;
		
		
		// PROPERTIES
		
		private var _app:App;
		
		
		// CONSTRUCTOR
		
		public function Main() {
			
			trace("*** Main");
			
			Logger.level = Logger.LEVEL_WARNING;
			
			_app = new App(this);
			
			_app.addEventListener(ConfLoadEvent.COMPLETE, confCompleteHandler, false, 1, true);
			_app.addEventListener(ConfLoadEvent.ERROR, confErrorHandler, false, 0, true);
			
			_app.loadConf("acto.xml");
			
		}


		// EVENT HANDLERS
		
		private function confCompleteHandler(event:ConfLoadEvent):void {
			dispatchEvent(new Event("startup", true));
		}
		
		private function confErrorHandler(event:ConfLoadEvent):void {
			trace("*** ERROR: Conf could not be loaded");
		}
		
		
	}
	
}
